<?php
/**
 * User: Allen
* Date: 16-02-29
* 首页中心
*/
class Welcome extends PC_Controller {

	public function __construct(){
		parent::__construct();
	}
		
	/**
	 * @brief 首页中心
	 * @param Null
	 * @par 2016/02/29 Ver 1.00 Created by Allen
	 */	
	public function index() {
		if($this->admin['admin_type']=='admin'){
			$this->load->model('system_config_model');
			$system_config=$this->system_config_model->checkSystem_config(array('id'=>'1'));
			if(empty($system_config)){
				$system_config['price']='0.000';
				$system_config['id']='0';
			}
			$this->data['data']=$system_config;
			$this->load->view('/admin/welcome.php',$this->data);
		}else{
			header("Location:http://".$_SERVER['HTTP_HOST']."/admin/user/user_list");
		}
		
	}
        /**
         * 保存设置
         */
        public function save(){
            if(!empty($_POST['price'])){
                $data['price']=$_POST['price'];
                $this->load->model('system_config_model');
                $system_config=$this->system_config_model->checkSystem_config(array('id'=>'1'));
                if(empty($system_config)){
                    $this->system_config_model->addSystem_config($data);
                }else{
                    $this->system_config_model->editSystem_config(array('id'=>'1'),$data);
                }
                
            }
            $this->location_href('/admin/welcome');
        }
}